﻿CREATE TRIGGER [tr_Menu_TypeID]
ON [dbo].[t_Menu]
FOR INSERT,UPDATE
AS
RETURN
--==========================================================================================
--==========================================================================================
--==========================================================================================
--==========================================================================================
IF NOT UPDATE(TypeID) RETURN

IF EXISTS(SELECT * FROM inserted i INNER JOIN t_Menu p ON i.ParentMenuID = p.MenuID WHERE i.ParentMenuID > 0 AND p.TypeID & 4 = 4 AND i.TypeID & 4 = 0 )BEGIN
	ROLLBACK TRAN
	RAISERROR('Parent of Queue must be a Queue as well',16,1)
	RETURN
END



